<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript" src="js/ping_tcss_https.js"></script>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script type="text/javascript">
    $(function () {
        $.ajax({
            type : "GET",
            url: "/jssdk/jssdk.php?url=" + encodeURIComponent(location.href.split('#')[0]) + '&_=' + Date.now(),
            dataType : "jsonp",
            jsonp:"callback",
            data:{},
            success : function(result){
                window.data = result;
                //wx.config(window.data.config);
                console.log(result);
                callback(window.data);
            }
        });
    });
    //jssdk分享配置
    function callback(data){
        wx.config(data.config);
        wx.ready(function(){
            wx.hideOptionMenu();
            wx.showMenuItems({menuList:['menuItem:share:appMessage','menuItem:share:timeline']});
            wx.onMenuShareAppMessage({
                title: data.share_app_info.title,
                desc: data.share_app_info.desc,
                link: data.share_app_info.link,
                imgUrl: data.share_app_info.img_url,
                success: function () {
                    vuxalert('分享朋友成功');
                },
                cancel: function () {
                    vuxalert('<br/><b>分享失败,请重新分享到<span style="font-size:30px;color:#f5294c">朋友</span></b>');
                }
            });

            wx.onMenuShareTimeline({
                title: data.share_timeline_info.title,
                link: data.share_timeline_info.link,
                imgUrl: data.share_timeline_info.img_url,
                type : "video",
                success: function () {
                    vuxalert('分享朋友圈成功',function () {
                        share_end();
                    });
                },
                cancel: function () {
                    vuxalert('<br/><b>分享失败,请重新分享到<span style="font-size:30px;color:#f5294c">朋友圈</span></b>');
                }
            });
        });
    }

    //分享结束后跳转
    function share_end(){
        location.href = 'http://qq.com';
    }
</script>
</body>
</html>